/*
 * @Description: 登录状态管理
 * @Author: ziwei.ma
 * @Date: 2019-06-27 14:39:38
 * @Last Modified by: ziwei.ma
 * @Last Modified time: 2019-06-27 17:02:09
 */
const state = {
  loginStatus: 0, // 0为未登录状态，1为登录
  resumeCount: 0
}

const getters = {
  loginStatus: state => state.loginStatus,
  resumeCount: state => state.resumeCount
}

const actions = {
  fetchLoginStatus: ({ commit, state }, text) => {
    commit('updateLoginStatus', text)
  },
  fetchResumeCount: ({ commit, state }) => {
    commit('updateResumeCount')
  }
}

const mutations = {
  updateLoginStatus: (state, payload) => {
    state.loginStatus = payload
  },
  updateResumeCount: state => {
    state.resumeCount++
  }
}

export default {
  state,
  getters,
  actions,
  mutations
}
